import java.lang.StringBuilder;

public class text1 {
    public static void main1(String[] args) {
        System.out.println("abc".toString());//输出abc
    }

    public static void main2(String[] args) {
        String str = "abcdef";
        char ch = str.charAt(2);
        System.out.println(ch);//输出str下标为2的值：c
    }

    public static void main3(String[] args) {
        String str1 = "abcdef";
        int ret1 = str1.compareTo("abcee");
        System.out.println(ret1);//输出-1
        int ret2 = str1.compareToIgnoreCase("AbcDe");
        System.out.println(ret2);//输出1
    }

    public static void main4(String[] args) {
        String str = "abcdef";
        boolean bool1 = str.contains("abc");
        boolean bool2 = str.contains("aaa");
        System.out.println(bool1);//输出true
        System.out.println(bool2);//输出false
    }

    public static void main5(String[] args) {
        String str = "abcdef";
        boolean bool1 = str.equals("abcdef");
        boolean bool2 = str.equals("aaa");
        System.out.println(bool1);//输出true
        System.out.println(bool2);//输出false
    }

    public static void main6(String[] args) {
        String str = "abcdef";
        boolean bool1 = str.equalsIgnoreCase("Abcdef");
        System.out.println(bool1);//输出true
    }

    public static void main7(String[] args) {
        String str = "abcdef";
        int ret = str.indexOf("cdef");
        System.out.println(ret);//输出2
        int ret2 = str.lastIndexOf("cde");
        System.out.println(ret2);//输出2
    }

    public static void main8(String[] args) {
        String str1 = "abcdef";
        boolean bool1 = str1.isEmpty();
        String str2 = "";
        boolean bool2 =  str2.isEmpty();
        System.out.println(bool1);//输出false
        System.out.println(bool2);//输出true
    }

    public static void main9(String[] args) {
        String str = "abcdef";
        System.out.println(str.length());//输出6
    }

    public static void main10(String[] args) {
        String str1 = "Hi do you like learning English?";
        String str2 = str1.replace(' ','/');
        System.out.println(str2);//输出Hi/do/you/like/learning/English?
        String str3 = str1.replaceFirst(" ",",");
        System.out.println(str3);//输出Hi,do you like learning English?
        String str4 = str1.replaceAll(" ","//");
        System.out.println(str4);//输出Hi//do//you//like//learning//English?
    }

    public static void main11(String[] args) {
        String str1 = "Hi do you like learning English?";
        String[] str2 = str1.split(" ");
        for (String x:str2) {
            System.out.println(x);/*输出 Hi
                                        do
                                        you
                                        like
                                        learning
                                        English?*/
        }
    }

    public static void main12(String[] args) {
        String str1 = "abcdef";
        String str2 = str1.substring(1,3);
        System.out.println(str2);//输出bc
    }

    public static void main13(String[] args) {
        String str1 = "abcdef";
        char[] str2 = str1.toCharArray();
        for (char ch:str2) {
            System.out.print(ch+" ");//输出a b c d e f
        }
    }

    public static void main14(String[] args) {
        String str1 = "abcdef";
        String str2 = str1.toUpperCase();
        System.out.println(str2);//输出ABCDEF
        String str3 = str2.toLowerCase();
        System.out.println(str3);//输出abcdef
    }

    public static void main15(String[] args) {
        String str1 = "   Hi do you like learning English?     ";
        String str2 = str1.trim();
        System.out.println(str1);//输出   Hi do you like learning English?
        System.out.println(str2);//输出Hi do you like learning English?
    }

    public static void main16(String[] args) {
        int ret = Integer.parseInt("1000");
        System.out.println(ret+3);//输出1003
    }

    public static void main17(String[] args) {
        StringBuilder strbu1 = new StringBuilder("abcdef");
        strbu1.reverse();
        System.out.println(strbu1);//输出fedcba
    }

    public static void main18(String[] args) {
        StringBuilder strbu1 = new StringBuilder("abcdef");
        strbu1.append('g');
        System.out.println(strbu1);//输出abcdefg
    }

    public static void main19(String[] args) {
        String s = String.format("%d-%d-%d", 2019, 9,14);
        System.out.println(s);//输出2019-9-14
    }
}
